from __future__ import annotations

from dataclasses import dataclass


@dataclass
class BlockEfficiency:
    efficiency: float
    running_rope_tension_kN: float
    hook_load_kN: float
    note: str


def calculate_block_efficiency(num_sheaves: int, bearing_coeff: float = 0.98, rope_bend_coeff: float = 0.99, hook_load_kN: float = 100.0) -> BlockEfficiency:
    """滑车组效率：η ≈ (η_bearing·η_bend)^(过滑轮次数)。"""

    passes = max(0, num_sheaves)
    eta = (bearing_coeff * rope_bend_coeff) ** passes
    running = hook_load_kN / max(1e-6, eta)
    return BlockEfficiency(efficiency=eta, running_rope_tension_kN=running, hook_load_kN=hook_load_kN, note="经验效率计算")


